function arr=mythreshold(arr, T)
    arr = (1-(arr>T)).*arr+(arr>T)*T;
    arr = (1-(arr<-T)).*arr-(arr<-T)*T;
end
